<template>
	<view>
		<view class="result">
			<view>
				<view class="result-success">
					<image src="../../static/images/result-que.png" mode="widthFix"></image>
					<text v-if="statu=='pay'">支付成功</text>
					<text v-if="statu=='deal'">交易成功</text>
					<text v-if="statu=='receive'">确认收货成功</text>
					<text v-if="statu=='evaluate'">评价成功</text>
				</view>
				<view class="result-button">
					<view class="result-btn" @tap="back">
						<text>返回首页</text>
					</view>
					<view class="result-btn right" v-if="statu!='evaluate'">
						<text v-if="statu=='pay'" @tap="goOrder">查看订单</text>
						<text v-if="statu=='receive'" @tap="goEvaluate">立即评价</text>
					</view>
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				statu:'',
				data:{}
			}
		},
		onLoad(e) {
			this.statu = e.type
			if(e.data){
				this.data = JSON.parse(decodeURIComponent(e.data))
			}
		},
		methods: {
			//返回首页
			back(){
				uni.switchTab({
					url:"../index/index"
				})
			},
			//查看订单
			goOrder(){
				let type = ""
				if(this.statu == 'pay'){
					type = 2
				}
				if(this.statu == 'deal'){
					type = 3
				}
				if(this.statu == 'receive'){
					type = 4
				}
				uni.navigateTo({
					url:'../myorder/myorder?type=' + type
				})
			},
			//评价
			goEvaluate(){
				uni.redirectTo({
					url:'../evaluate/evaluate?data=' + encodeURIComponent(JSON.stringify(this.data))
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.result{
		height: 400upx;
		background-size: 100% 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		background-image: url('');
		.result-success{
			display: flex;
			align-items: center;
			justify-content: center;
			font-size:40upx;
			font-weight:bold;
			color:rgba(255,255,255,1);
			image{
				width: 40upx;
				height: 40upx;
				margin-right: 10upx;
			}
		}
		.result-button{
			display: flex;
			justify-content: center;
			margin-top: 50upx;
			width: 400upx;
			.result-btn{
				text-align: center;
				font-size:28upx;
				font-weight:500;
				color:rgba(255,255,255,1);
				width:172upx;
				line-height:48upx;
				border:1upx solid rgba(255,255,255,1);
				border-radius:24upx;
			}
			.right{
				margin-left:81upx;
			}
		}
	}
</style>
